////////////////////////////////////////////////////////////////////////////////
//	Copyright (c) 2004 by Michael 'Astar' Sotnikov
//	stari4ek at gmail dot com
////////////////////////////////////////////////////////////////////////////////

#include <vector>
#include <string>

#include "core/cSmartAssert.hpp"

#ifdef MSC_VER
#pragma warning(push)
#pragma warning(disable: 4127)		// warning C4127: conditional expression is constant
#endif // MSC_VER

void testSmartAssert()
{
	SMART_ASSERT( 1 == 2 ).warn( "simple warn" );
	SMART_ASSERT( 5 == 6 ).error( "simple error" );
	SMART_ASSERT( 5 == 6 ).fatal( "simple fatal" );

	SMART_FAILED().warn( "failed Warn" );
	SMART_FAILED().error( "failed Error" );
	SMART_FAILED().fatal( "failed Fatal" );

	const int i = 15;
	const float f = 4.65f;
	std::vector<int> vecI;
	vecI.push_back( 12 );	
	vecI.push_back( 4 );
	vecI.push_back( 8 );

	SMART_ASSERT( i <= 3 )( i ).warn( "int value" );
	SMART_ASSERT( f >= 16.6f )( f ).error( "float value" );
	SMART_ASSERT( vecI.empty() )( vecI ).fatal( "vector of int" );

	std::string str( "Hello World!" );

	SMART_ASSERT( str.find( "Hllo" ) != std::string::npos )( str ).warn( "string value" );

	struct testStruct{
		static void foo(){
			SMART_FAILED().error( "check method" );
		}
	};
	testStruct::foo();
}

#ifdef MSC_VER
#pragma warning(pop)	// C4127
#endif // MSC_VER
